/**
 * Created by ospip on 2017/10/16.
 * Copyright (c) 2017 LLAP. All rights reserved.
 */
public class CircularCone implements Area, Volume{
    protected double r, h;
    public CircularCone(double radius, double height) {
        r = radius;
        h = height;
    }
    public CircularCone() {
        this(0, 0);
    }
    public void setR(double r) {
        this.r = r;
    }
    public void setH(double h) {
        this.h = h;
    }
    @Override
    public String toString() {
        return "CircularCone{" +
                "r=" + r +
                ", h=" + h +
                ", volume=" + this.volume() +
                '}';
    }
    public double getR() {
        return r;
    }
    public double getH() {
        return h;
    }
    @Override
    public double area() {
        return 2 * Math.PI * r + 0.5 * (2 * Math.PI * r) * Math.sqrt(r * r + h * h);
    }
    @Override
    public double volume() {
        return Math.PI * r * r * h / 3;
    }
    public static void main(String[] args) {
        CircularCone c = new CircularCone(5, 10);
        System.out.println(c);
    }
}
